﻿using UnityEngine;
using System.Collections;

public class ZiDanShengJi : MonoBehaviour {

    Transform m_Transform;
    //声音类型
    public int m_a = 0;
    //移动速度
    float m_speed = 0.3F;

	void Start () {

        m_Transform = this.transform;
	}
	
	
	void Update () {

        m_Transform.Translate(0, -m_speed * Time.deltaTime, 0);
	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag.CompareTo("Player") == 0)
        {
            Instantiate(Resources.Load<GameObject>(SampleXml.prefabPath[m_a].ToString()));
            Destroy(this.gameObject,0.1F);
        }else if (other.tag.CompareTo("Bounds") == 0){
            Destroy(this.gameObject);
        }
    }
}
